﻿using Mes.Domain.BoundedContext.EntityBase;

namespace Mes.Domain.BoundedContext.Entities.WorkOrders
{
    public class JobBom : NoIdEntityBase
    {
        public JobBom() { }

        public JobBom(string woId, string operId, int bomPos, int itemId, double qtyPerParentItem, double reqdStartVal)
        {
            Wo_Id = woId;
            Oper_Id = operId;
            Bom_Pos = bomPos;
            Item_Id = itemId;
            Qty_Per_Parent_Item = qtyPerParentItem;
            Reqd_Start_Val = reqdStartVal;
        }

        public JobBom(string woId, string operId, int bomPos, int itemId, int? defStorageEntId, double qtyPerParentItem, /*double? maxQtyPerParentItem, double? minQtyPerParentItem,*/ double reqdStartVal)
        {
            Wo_Id = woId;
            Oper_Id = operId;
            Bom_Pos = bomPos;
            Item_Id = itemId;
            Def_Storage_Ent_Id = defStorageEntId;
            Qty_Per_Parent_Item = qtyPerParentItem;
            //Max_Qty_Per_Parent_Item = maxQtyPerParentItem;
            //Min_Qty_Per_Parent_Item = minQtyPerParentItem;
            Reqd_Start_Val = reqdStartVal;
        }

        public string Wo_Id { get; set; } = string.Empty;

        public string Oper_Id { get; set; } = string.Empty;

        public int Seq_No { get; set; } = 0;

        public int Bom_Pos { get; set; } = 0;

        public int Item_Id { get; set; } = 0;

        public int? Reqd_Grade_Cd { get; set; } = null;

        public string? Instruction { get; set; } = null;

        public double Qty_Per_Parent_Item { get; set; } = 0;

        public double? Max_Qty_Per_Parent_Item { get; set; } = null;

        public double? Min_Qty_Per_Parent_Item { get; set; } = null;

        public double Reqd_Start_Val { get; set; } = 1;

        public bool Reqd_Start_Val_Is_Pct { get; set; } = false;

        public bool Update_Inv { get; set; } = false;

        public bool Backflush { get; set; } = false;

        public int? Def_Reas_Cd { get; set; } = null;

        public string? Def_Lot_No { get; set; } = null;

        public string? Def_Sublot_No { get; set; } = null;

        public int? Def_Storage_Ent_Id { get; set; } = null;

        public int? Def_Reject_Ent_Id { get; set; } = null;

        public double? scaling_factor { get; set; } = null;

        public bool Must_Consume_From_Inv { get; set; } = false;

        public bool May_Choose_Alt_Inv_Loc { get; set; } = false;

        public bool May_Create_New_Lots { get; set; } = false;

        public bool Must_Consume_From_Wip { get; set; } = false;

        public bool Must_Consume_Before_Prod { get; set; } = false;

        public bool Constant_Qty { get; set; } = false;

        public double? Est_Time { get; set; } = null;

        public int? Current_Subst { get; set; } = null;

        public double? Qty_Reqd { get; set; } = null;

        public bool Serial_No_Source { get; set; } = false;

        public string? Spare1 { get; set; } = null;

        public string? Spare2 { get; set; } = null;

        public string? Spare3 { get; set; } = null;

        public string? Spare4 { get; set; } = null;

        public string? Last_Edit_Comment { get; set; } = null;

        public string? Last_Edit_By { get; set; } = null;

        public DateTime Last_Edit_At { get; set; } = DateTime.Now;

        public long Mod_Id { get; set; } = 0;

        public int Row_Id { get; set; } = 0;
    }
}
